<template>
  <div class="team">
    <div class="header">
      <span>专家团队</span>
    </div>
    <el-button class="change" @click="handleAdd">+新增专家</el-button>
    <div class="line"></div>
    <el-table
    :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
    :data="tableData" border style="width: 100%">
      <el-table-column fixed prop="num" label="序号" width="100" />
      <el-table-column prop="username" label="名字" width="200" />
      <el-table-column prop="userjob" label="职称" width="200" />
      <el-table-column prop="region" label="推荐至首页" width="100" />
      <el-table-column prop="zip" label="排序" width="200">
        <template #default="scope">
          <div>
            <span style="margin-left: 10px"
              ><input v-model="scope.row.zip"
            /></span>
          </div>
        </template>
      </el-table-column>
      <el-table-column prop="time" label="时间" width="200" />
      <el-table-column label="操作" width="200">
        <template #default="scope">
          <el-button
            link
            type="primary"
            size="small"
            @click="handleUpdate(scope.row.num)"
            >编辑</el-button
          >
          <el-button
            link
            type="primary"
            size="small"
            @click="handleremove(scope.row.num)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script  setup>
import { useRouter } from "vue-router";
import dayJS from "dayjs";
import useTeamStore from "../../store/team";
import { ref } from "@vue/reactivity";
const store = useTeamStore();
const tableData = ref([]);
tableData.value = store.teamList;
const router = useRouter();
//跳转添加专家界面
const handleAdd = () => {
  router.push("/expert");
};
// 跳转编辑页面
const handleUpdate = (num) => {
  router.push({
    path: "/expert",
    query: {
      num,
    },
  });
};

// 删除数据
const handleremove = (id) => {
  store.removeTeamList(id);
};
</script>

<style lang="less" scoped>
.header {
  width: 100%;
  height: 40px;
  padding: 5px;
  color: rgb(255, 153, 0);
  line-height: 30px;
  span {
    display: inline-block;
    width: 100px;
    height: 26px;
    border-left: 6px solid rgb(255, 153, 0);
    padding: 5px;
  }
}
.line {
  height: 10px;
  width: 100%;
  background-color: rgb(246, 239, 239);
  margin: 15px 0;
}
.change {
  background-color: rgb(255, 153, 0);
  color: #fff;
  margin-left: 5px;
}
input {
  width: 50px;
}
</style>
